﻿//-------------------------------------------------------------------
//	Copyright (c) 2010-2013 Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_STL_Ext.h".
//-------------------------------------------------------------------

#ifndef _UXS_GLES_OBJECT_MANAGER_H
#define _UXS_GLES_OBJECT_MANAGER_H

#include "GLESCommon.h"

namespace UX_STL
{
namespace GLESshell
{

	//
	// Object Manager
	//

	class _EXPORT_ GLESObjectManager : public GLESBaseObject
	{
#ifdef UX_GL_USE_VAO
	public:
		bool GenVertexArrays(GLsizei n, GLuint * arrays);
		bool DeleteVertexArrays(GLsizei n, const GLuint * arrays);

		static bool s_GetAttribs(GLuint uVAO, GLESVerticesAttribsExt_t &aAttribs);
		static bool s_SetAttribs(GLuint uVAO, const uni_array<const GLESVertexAttribExt> &aAttribs);
#endif	// UX_GL_USE_VAO

	public:
		GLESObjectManager();
		~GLESObjectManager();

		void CheckNotReleasedObjects();

		bool GenBuffers(GLsizei n, GLuint * buffers) const;
		bool GenFramebuffers(GLsizei n, GLuint * ids) const;
		bool GenProgramPipelines(GLsizei n, GLuint * pipelines) const;
		bool GenQueries(GLsizei n, GLuint * ids) const;
		bool GenRenderbuffers(GLsizei n, GLuint * renderbuffers) const;
		bool GenTextures(GLsizei n, GLuint * textures) const;
		bool CreateShader(GLenum shaderType, GLuint &shader) const;
		bool CreateProgram(GLuint &program) const;

		bool DeleteBuffers(GLsizei n, const GLuint * buffers) const;
		bool DeleteFramebuffers(GLsizei n, const GLuint * ids) const;
		bool DeleteProgramPipelines(GLsizei n, const GLuint * pipelines) const;
		bool DeleteQueries(GLsizei n, const GLuint * ids) const;
		bool DeleteRenderbuffers(GLsizei n, const GLuint * renderbuffers) const;
		bool DeleteTextures(GLsizei n, const GLuint * textures) const;
		bool DeleteShader(GLuint shader) const;
		bool DeleteProgram(GLuint program) const;
	};

//-------------------------------------------------------------------
	
}	// GLESshell
}	// UX_STL

#endif	// _UXS_GLES_OBJECT_MANAGER_H